home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / MW MPW Binaries 1.1.1a2 / mwcPPC / MWCIncludes / ostream < prev    next >
Encoding:
Text File  |  1994-07-18  |  2.4 KB  |  87 lines  |  [TEXT/MMCC]

  1. // ostream standard header
  2. #ifndef _OSTREAM_
  3. #define _OSTREAM_
  4. #include <streambuf>
  5.  
  6. #if __MWERKS__
  7. #pragma options align=mac68k
  8. #endif
  9.  
  10.         // class ostream
  11. class ostream : virtual public ios {
  12. public:
  13.     ostream(streambuf *_S)
  14.         : ios(_S) {}
  15.     ostream(_Uninitialized)
  16.         : ios(_Noinit) {}
  17.     virtual ~ostream();
  18.     _Bool opfx();
  19.     void osfx();
  20.     ostream& operator<<(ostream& (*_F)(ostream&))
  21.         {return ((*_F)(*this)); }
  22.     ostream& operator<<(ios& (*_F)(ios&))
  23.         {(*_F)(*(ios *)this); return (*this); }
  24.     ostream& operator<<(const char *);
  25.     ostream& operator<<(char _C)
  26.         {put(_C); return (*this); }
  27.     ostream& operator<<(unsigned char _C)
  28.         {return (*this << (char)_C); }
  29.     ostream& operator<<(short _X)
  30.         {return (_Print(&"B hoB hxB hd"[_If()], _X)); }
  31.     ostream& operator<<(unsigned short _X)
  32.         {return (_Print(&"B hoB hxB hu"[_If()], _X)); }
  33.     ostream& operator<<(int _X)
  34.         {return (_Print(&"B  oB  xB  d"[_If()], _X)); }
  35.     ostream& operator<<(unsigned int _X)
  36.         {return (_Print(&"B  oB  xB  u"[_If()], _X)); }
  37.     ostream& operator<<(long _X)
  38.         {return (_Print(&"B loB lxB ld"[_If()], _X)); }
  39.     ostream& operator<<(unsigned long _X)
  40.         {return (_Print(&"B loB lxB lu"[_If()], _X)); }
  41.     ostream& operator<<(float _X)
  42.         {return (_Print(&"P. eP. fP. g"[_Ff()], _Pr(), _X)); }
  43.     ostream& operator<<(double _X)
  44.         {return (_Print(&"P.leP.lfP.lg"[_Ff()], _Pr(), _X)); }
  45.     ostream& operator<<(long double _X)
  46.         {return (_Print(&"P.LeP.LfP.Lg"[_Ff()], _Pr(), _X)); }
  47.     ostream& operator<<(void *);
  48.     ostream& operator<<(streambuf&);
  49.     ostream& put(char);
  50.     ostream& write(const char *, int);
  51.     ostream& write(const unsigned char *_S, int _N)
  52.         {return (write((const char *)_S, _N)); }
  53.     ostream& flush();
  54. #if _SIGNED_CHAR_IS_DISTINCT
  55.     ostream& operator<<(signed char _C)
  56.         {return (*this << (char)_C); }
  57.     ostream& write(const signed char *_S, int _N)
  58.         {return (write((const char *)_S, _N)); }
  59. #endif /* _SIGNED_CHAR_IS_DISTINCT */
  60. protected:
  61.     int _Ff()
  62.         {return ((flags() & floatfield) == scientific ? 0
  63.             : (flags() & floatfield) == fixed ? 4 : 8); }
  64.     int _If()
  65.         {return ((flags() & basefield) == oct ? 0
  66.             : (flags() & basefield) == hex ? 4 : 8); }
  67.     void _Pad(const char *, char *, int);
  68.     int _Pr();
  69.     ostream& _Print(const char *, ...);
  70.     };
  71.         // manipulators
  72. ostream& endl(ostream&);
  73. ostream& ends(ostream&);
  74. ostream& flush(ostream&);
  75.  
  76. #if __MWERKS__
  77. #pragma options align=reset
  78. #endif
  79.  
  80. #endif
  81.  
  82. /*
  83.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  84.  * Consult your license regarding permissions and restrictions.
  85.  */
  86.  
  87.